
import 'package:fate_blind_box/utils/default/common_config.dart';
import 'package:fate_blind_box/widget/icon_text.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

class PayoutWidget extends StatefulWidget {
  const PayoutWidget({Key? key}) : super(key: key);

  @override
  State<PayoutWidget> createState() => _PayoutWidgetState();
}

class _PayoutWidgetState extends State<PayoutWidget> {
  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    final iconWidth = (size.width - 64) / 2;
    final iconHeight = iconWidth / 157 * 120;
    return Container(
      height: iconHeight + 110,
      decoration: const ShapeDecoration(
        color: Colors.white,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.vertical(top: Radius.circular(8))
        )
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            margin: const EdgeInsets.symmetric(vertical: 16),
            width: 42,
            height: 4,
            decoration: ShapeDecoration(
                shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
                color: const Color(0xFFEEEEEE)
            ),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Opacity(
                child: Row(
                  children: [
                    const SizedBox(width: 24,),
                    IconText(
                      "邀请说明 ",
                      style: const TextStyle(fontSize: 12),
                      icon: Image.asset("images/ic_question.png", width: 13, height: 13),
                      beforeText: false,
                    )
                  ],
                ),
                opacity: 0,
              ),
              const Text(
                "增加偶遇机会",
                style: TextStyle(color: Colors.black, fontSize: 16),
              ),
              GestureDetector(
                onTap: () {

                },
                child: Opacity(
                  child: Row(
                    children: [
                      IconText(
                        "邀请说明 ",
                        style: const TextStyle(fontSize: 12),
                        icon: Image.asset("images/ic_question.png", width: 13, height: 13),
                        beforeText: false,
                      ),
                      const SizedBox(width: 24,)
                    ],
                  ),
                  opacity: 0,
                )
              ),
            ],
          ),
          const SizedBox(height: 20,),
          Row(
              children: [
                const SizedBox(width: 24,),
                Offstage(
                  offstage: false,
                  child: GestureDetector(
                    onTap: () {
                      Navigator.of(context).pop(1);
                    },
                    child: Image.asset(
                      "images/ic_payout_invite.png",
                      width: iconWidth,
                      height: iconHeight,
                    ),
                  ),
                ),
                const SizedBox(width: 16,),
                GestureDetector(
                  onTap: () {
                    Navigator.of(context).pop(2);
                  },
                  child: Image.asset(
                    "images/ic_payout.png",
                    width: iconWidth,
                    height: iconHeight,
                  ),
                )
              ]
          ),
          // const SizedBox(height: 24,),
          // Text.rich(TextSpan(
          //     children: [
          //       const TextSpan(
          //           text: "充值代表已阅读并同意",
          //           style: TextStyle(color: Color(0xFF222222), fontSize: 12)
          //       ),
          //       TextSpan(
          //         text: "《用户充值协议》",
          //         style: const TextStyle(color: Color(0xFF03488D), fontSize: 12),
          //         recognizer: TapGestureRecognizer()..onTap = () {
          //           print('用户协议');
          //         },
          //       )
          //     ]
          // ))
        ],
      ),
    );
  }
}
